package com.developerstation.barcode.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.developerstation.barcode.mapper.AdminMapper;
import com.developerstation.barcode.model.Admin;
import com.developerstation.barcode.model.AdminExample;
import com.developerstation.barcode.service.AdminService;

@Service
public class AdminServiceImpl implements AdminService {

	@Resource
	private AdminMapper adminMapper;
	@Override
	public Admin queryAdminByUserNamePasswordAndCKSoftPwd(Admin admin) {
		AdminExample example = new AdminExample();
		example.createCriteria().andCkEqualTo(admin.getCk())
								.andUsernameEqualTo(admin.getUsername())
								.andPasswordEqualTo(admin.getPassword())
								.andCssoftPasswordEqualTo(admin.getCssoftPassword())
//								.andLoginIpEqualTo(admin.getLoginIp())
								.andIsEnabledEqualTo(true);
		List<Admin> list = adminMapper.selectByExample(example);
		if(list == null || list.size()!=1) return null;
		return list.get(0);
	}

}
